package com.xinan.hygl;

import com.jfinal.ext.plugin.tablebind.TableBind;
import com.jfinal.kit.StringKit;
import com.jfinal.plugin.activerecord.Db;
import com.jfinal.plugin.activerecord.Model;
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;

import java.sql.Timestamp;
import java.util.List;
import java.sql.Date;

@TableBind(tableName = "hygl_jfjl")
public class HyglJfjl extends Model<HyglJfjl> {
	public static final HyglJfjl dao = new HyglJfjl();

	// columns START
	private String ID = "id"; // id
	private String WPID = "wpid"; //
	private String WPMC = "wpmc"; //
	private String FWLXID = "fwlxid"; //
	private String FWLXMC = "fwlxmc"; //
	private String START = "start"; // 开始日期
	private String END = "end"; // 结束日常
	private String XFJF = "xfjf";// 消费积分

	public void setId(int value) {
		set(ID, value);
	}

	public int getId() {
		return get(ID);
	}

	public void setWpid(String value) {
		set(WPID, value);
	}

	public String getWpid() {
		return get(WPID);
	}

	public void setWpmc(String value) {
		set(WPMC, value);
	}

	public String getWpmc() {
		return get(WPMC);
	}

	public void setStart(Date value) {
		set(START, value);
	}

	public Date getStart() {
		return get(START);
	}

	public void setEnd(Date value) {
		set(END, value);
	}

	public Date getEnd() {
		return get(END);
	}

	public String getXFJF() {
		return XFJF;
	}

	public void setXFJF(String xFJF) {
		XFJF = xFJF;
	}

	public void setFwlxid(String value) {
		set(FWLXID, value);
	}

	public String getFwlxid() {
		return get(FWLXID);
	}

	public void setFwlxmc(String value) {
		set(FWLXMC, value);
	}

	public String getFwlxmc() {
		return get(FWLXMC);
	}

	// columns END

	public List<HyglJfjl> findAll() {
		return find("select * from hygl_jfjl");
	}

	/**
	 * @param where
	 * @return Record
	 */
	public List<Record> findAlls(String where) {
		String sqlExp = " from hygl_jfjl";
		if (StringKit.notBlank(where)) {
			sqlExp += " where " + where;
		}
		return Db.find("select * " + sqlExp);

	}

	public Page<HyglJfjl> page(int pageNumber, int pageSize, String where) {
		String sqlExp = "from hygl_jfjl";
		if (StringKit.notBlank(where)) {
			sqlExp += " where " + where;
		}
		return paginate(pageNumber, pageSize, "select *", sqlExp);
	}

}
